﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Ooaavee.Support;
using Ooaavee.TestTools;

namespace UnitTests.Ooaavee.Support
{
    /// <summary>
    /// Tests Reflector class.
    /// </summary>
    [TestClass]
    public class ReflectorTest : TestBase
    {
        /// <summary>
        /// Tests GetReflectedObject method.
        /// </summary>
        [TestMethod]
        public void GetReflectedObjectTest()
        {

            Parent parent = new Parent();
            parent.Name = "Grand Master";
            parent.Age = int.MaxValue;

            Child child1 = new Child {Name = "Number 1", Age = 1};
            child1.Friends.Add(new Friend() {  Age = 2,IsBestFriend = true, Name = "The Best Friend"} );
            parent.Childs.Add(child1);

            Child child2 = new Child { Name = "Number 2", Age = 12 };
            child2.Friends.Add(new Friend() { Age = 2, IsBestFriend = true, Name = "The Best Friend" });
            child2.Friends.Add(new Friend() { Age = 23, IsBestFriend = false, Name = "The Other Friend" });
            parent.Childs.Add(child2);

            Reflector.ReflectedObject reflectedObject = Reflector.GetReflectedObject(parent);




            //ReflectedObject reflectedObject = Ref
        }


        private class Parent : Person
        {
            private int _privaatinMuuttujanNimi;
            protected DateTime _protectedMuuttujanNimi;
            public string _publicMuuttujanNimi;

            private string PrivateProperty1 { set; get; }
            protected int ProtectedProperty1 { set; get; }
   
            private readonly List<Child> _childs = new List<Child>();
            private readonly List<Friend> _friends = new List<Friend>();

            public List<Child> Childs { get { return _childs; } }
            public List<Friend> Friends { get { return _friends; } }

            public string SetteriOminaisuus {
                set { }
            }
        }

        private class Child : Person
        {
            private readonly List<Friend> _friends = new List<Friend>();
            public List<Friend> Friends { get { return _friends; } } 
            
        }

        private class Friend : Person
        {
            public bool IsBestFriend { set; get; }
        }

        private class Person
        {
            public string Name { set; get; }
            public int Age { set; get; }
        }


    }
}
